home
***
CD-ROM
|
disk
|
FTP
|
other
***
search
/
Fritz: All Fritz
/
All Fritz.zip
/
All Fritz
/
FILES
/
UTILSTEM
/
UTIL2.LZH
/
KEY-FAKE.DOC
< prev
next >
Wrap
Text File
|
1986-11-05
|
6KB
|
116 lines
HOW TO USE KEY-FAKE.COM
Our programming fakir turns faker to con programs into thinking
you're actually typing the keystrokes they need to get started.
KEY-FAKE.COM is a utility designed to extend the usefulness of
your batch files by letting you supply all the necessary initial
keystrokes to programs automatically. Indeed, in addition to
handling program preliminaries, KEY-FAKE can even be made to run
a whole program without any keyboard intervention on your part.
The author of this utility program is Charles Petzold, a
contributing editor of PC Magazine. The BASIC source code to
make KEY-FAKE.COM appeared in the December 24,1985 issue of PC
Magazine, Volume 4, Number 26.
USING KEY-FAKE.COM - The best way to understand how to use KEY-
FAKE and what it does is by looking at a few examples. Suppose
that every time you enter BASICA you execute a COLOR command to
create a blue border and background with yellow letters and then
usually use the F3 key to load a program. With KEY-FAKE, you
would create a two-line batch file to load BASICA:
KEY-FAKE "COLOR 14,1,1" 13 "CLS" 13 @61
BASICA
After BASICA loads, it begins to check for commands coming from
the keyboard. The first keystrokes it reads, in this case, are
those that come from the KEY-FAKE parameter. It reads the COLOR
command, clears the screen, and then gets ready to load a program.
Let's look at some other examples. You have a program called
SpelRite that asks you for the filename and the subdirectory
where the program is located every time you run the program and
the program doesn't accept command line parameters. You can use
the following batch file called SR.BAT:
KEY-FAKE "%1" 13 "\SPELRITE" 13
SPELRITE
When you enter SR followed by a filename, the name will be
substituted for %1 when the batch executes. KEY-FAKE then
answers the two questions for you.
Now for some more interesting applications of KEY-FAKE. How
would you like to print several WORDSTAR files using one batch
command? Let's call this file WSP.BAT.
CD\WORDSTAR
:CHECK
IF /%1==/ GOTO END
KEY-FAKE "P%1" 27 "X"
WS
SHIFT
GOTO CHECK
:END
You executes it by typing:
WSP file1 file2 file3 ...
WSP.BAT uses the IF statement to check whether a parameter is
present. If so, the filename parameter is substituted for %1 in
the KEY-FAKE command. Then WORDSTAR runs, executing P (for Print),
the filename, an ESC (decimal 27), and X (for EXIT). When it
exit back to the batch file, WSP.BAT does a SHIFT command, making
%1 the next file in the list, and goes through the routine again.
Some programs, like LOTUS's 1-2-3, clear out the keyboard buffer
when they load. When the digit 0 appears in a KEY-FAKE parameter,
it takes on special meaning. If a program checks to see if any
keys are waiting, KEY-FAKE will say "NO." The program thinks that
no keys are available and clears the buffer. When the program
checks again, KEY-FAKE says "YES" and delivers the next keystroke.
Every time you enter 1-2-3, you do a File Retrieve command. Use
the batch file called L.BAT.
CD\LOTUS
KEY-FAKE 0 13 0 13 0 13 0 13 0 13 "/FR"
LOTUS
The string of 0s and 13s was developed empirically, but it works
well, skipping past the LOTUS Access System Menu right into 1-2-3.
You could even develop KEY-FAKE parameters that carry programs
through an entire task. For instance, you could import an ASCII
table of numbers into 1-2-3, save it as a worksheet file, exit to
the Lotus Access System Menu, convert the 1-2-3 file to a .DIF
file, and then run a BASICA program that used the .DIF file, all
by executing one batch file.
RULE ONE - KEY-FAKE must be executed before the program that
will use the keystrokes.
RULE TWO - Anything placed within a pair of single or double
quotes is interpreted as normal text.
RULE THREE - ASCII codes are specified by decimal numbers. A 13 is
the ENTER key, 27 is the ESC key, & a 9 is the TAB key.
RULE FOUR - Decimal numbers preceded by the @ symbol are extended
ASCII codes (decimal codes 128 to 255).
RULE FIVE - A zero (0) is a special code to signal to programs
that the keyboard buffer is clear.
RULE SIX - The parameter length is limited to 127 characters.
To get the complete story, see the article, which starts on
page 215 of the above mentioned issue of PC Magazine.
To print this file, which is two page long, set the printer to
the top of the page and enter the following command:
A>copy KEY-FAKE.DOC prn